package com.ychug.front.front;

import com.ychug.framework.business.consts.FrontConst;
import com.ychug.framework.config.FreeMarkerConfig;
import com.ychug.framework.core.advice.AdDirective;
import com.ychug.framework.util.TempleteUtile;
import com.ychug.framework.web.base.BaseController;
import com.ychug.service.cms.entity.CmsSiteEntity;
import com.ychug.service.cms.service.ICmsSiteService;
import com.ychug.service.system.entity.SysConfigEntity;
import com.ychug.service.system.service.ISysConfigService;
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.ClassUtils;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 首页 业务处理
 *
 * @author dds
 */
@Controller
public class IndexController extends BaseController {

    @Autowired
    private ICmsSiteService cmsSiteService;
    @Autowired
    private ISysConfigService sysConfigService;

    /**
     * 访问首页加载时
     * @param request
     * @param response
     * @return
     */
    @RequestMapping("/index")
    public ModelAndView index(ModelAndView modelAndView,HttpServletRequest request, HttpServletResponse response, ModelMap mmap){

       CmsSiteEntity cmsSiteEntity = getCmsSiteEntity();
       FrontConst.setCmsSiteEntity(cmsSiteEntity);
       mmap.put("site",cmsSiteEntity);
       modelAndView.setViewName("index222");
       return modelAndView;
    }



}
